#include "client.h"

//封装初始化头结点
struct clientlist *list_init()
{
	struct clientlist *head=malloc(sizeof(struct clientlist));
	head->next=NULL;
	return head;	
}

//尾插结点
int cli_insert_tail(struct clientlist *newnode,struct clientlist *head)
{
	//找到尾部
	struct clientlist *p=head;
	while(p->next!=NULL)
		p=p->next;
	
	//把新的结点尾插
	p->next=newnode;
	return 0;
}

//遍历链表
int cli_list_show(struct clientlist *head)
{
	struct clientlist *p=head;
	while(p->next!=NULL)
	{
		p=p->next;
		printf("目前连接成功的客户端IP为:%s,端口号为:%d\n",p->ipaddr,p->clientport);
	}
	return 0;
}
